import requests
from config import url_cloud,headers_web

class AuthorizationTimespanConfig:
    def __int__(self):
        self.url = url_cloud
        self.headers = headers_web

    @classmethod
    def get_timespanconfigs(cls,url_cloud :str,headers = headers_web, params =None):
        '''
        summary:接口-授权时间段列表
        description:云课堂管理端授权时间段配置使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/api/v1/authorizationtimespanconfigs"
        r = requests.get(url= url,headers= headers,params= params)
        return  r

    @classmethod
    def get_timespantypes(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        summary:接口-获取授权时间段类型
        description:云课堂管理端授权时间段配置使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/api/v1/authorizationtimespanconfigs/timespantypes"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def post_timespanconfigs(cls,url_cloud :str,headers = headers_web, params =None,json= None):
        """
        summary:接口-新增授权时间段
        description:1、云课堂管理端授权时间段配置使用
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :return:
        """
        url = url_cloud + "/teachinglaboratoryapi/api/v1/authorizationtimespanconfigs"
        r = requests.post(url=url, headers=headers, params=params,json= json)
        return r

    @classmethod
    def post_deltimespanconfigs(cls,url_cloud :str,headers = headers_web, params =None,paramspath= None):
        """
        summary:接口-删除授权时间段
        description:1、云课堂管理端授权时间段配置使用
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :return:
        """
        url = url_cloud + f"/teachinglaboratoryapi/api/v1/authorizationtimespanconfigs/{paramspath}"
        r = requests.post(url=url, headers=headers, params=params)
        return r